package com.woniu.controller;

import com.woniu.entity.Orders;
import com.woniu.service.OrdersService;
import com.woniu.service.impl.OrdersServiceImpl;

import java.util.List;

public class OrdersController {
    public static void insertOrder(Orders order) {
         OrdersServiceImpl ordersService = new OrdersServiceImpl();
         ordersService.insertOrders(order);
    }
    public static List<Orders> getAllOrders(Integer uid) {
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        return ordersService.selectOrdersByUid(uid);
    }
    public static void deleteOrder(Integer id) {
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        ordersService.deleteOrders(id);
    }
    public static List<Orders> getAllOrders(){
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        return ordersService.selectOrders();
    }
    public static void updateOrdersStatus(Integer order_id,Integer status){
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        ordersService.updateOrdersStatus(order_id,status);
    };
    public static Orders selectOrdersByOrderID(Integer order_id){
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        return ordersService.selectOrdersByOrderID(order_id);
    };
    public static void updateOrderstotal(Integer order_id,double price){
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        ordersService.updateOrdersTotal(order_id,price);
    };
    public static void deleteOrdersByorderId(Integer order_id){
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        ordersService.deleteOrdersByorderId(order_id);
    };
    public static List<Orders> selectOrdersBStatus(int status){
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        return ordersService.selectOrdersBStatus(status);
    };

    public static List<Orders> selectOrdersUidStatus(int uid, int status){
        OrdersServiceImpl ordersService = new OrdersServiceImpl();
        return ordersService.selectOrdersUidStatus(uid,status);
    }
}
